<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
if (window.internals)
  internals.settings.setEditingBehavior('win');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">|    אבצ    דעפ    חיח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">|    אבצ    דעפ    חיח    ופק    </div>',
  '39-0 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre"> |   אבצ    דעפ    חיח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">|    אבצ    דעפ    חיח    ופק    </div>',
  '39-1 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">  |  אבצ    דעפ    חיח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">|    אבצ    דעפ    חיח    ופק    </div>',
  '39-2 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">   | אבצ    דעפ    חיח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">|    אבצ    דעפ    חיח    ופק    </div>',
  '39-3 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    |אבצ    דעפ    חיח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">|    אבצ    דעפ    חיח    ופק    </div>',
  '39-4 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    א|בצ    דעפ    חיח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    |אבצ    דעפ    חיח    ופק    </div>',
  '39-5 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אב|צ    דעפ    חיח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    |אבצ    דעפ    חיח    ופק    </div>',
  '39-6 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ|    דעפ    חיח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    |אבצ    דעפ    חיח    ופק    </div>',
  '39-7 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ |   דעפ    חיח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    |אבצ    דעפ    חיח    ופק    </div>',
  '39-8 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ  |  דעפ    חיח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    |אבצ    דעפ    חיח    ופק    </div>',
  '39-9 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ   | דעפ    חיח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    |אבצ    דעפ    חיח    ופק    </div>',
  '39-10 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    |דעפ    חיח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    |אבצ    דעפ    חיח    ופק    </div>',
  '39-11 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    ד|עפ    חיח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    |דעפ    חיח    ופק    </div>',
  '39-12 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דע|פ    חיח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    |דעפ    חיח    ופק    </div>',
  '39-13 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ|    חיח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    |דעפ    חיח    ופק    </div>',
  '39-14 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ |   חיח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    |דעפ    חיח    ופק    </div>',
  '39-15 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ  |  חיח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    |דעפ    חיח    ופק    </div>',
  '39-16 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ   | חיח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    |דעפ    חיח    ופק    </div>',
  '39-17 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    |חיח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    |דעפ    חיח    ופק    </div>',
  '39-18 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    ח|יח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    |חיח    ופק    </div>',
  '39-19 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    חי|ח    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    |חיח    ופק    </div>',
  '39-20 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    חיח|    ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    |חיח    ופק    </div>',
  '39-21 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    חיח |   ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    |חיח    ופק    </div>',
  '39-22 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    חיח  |  ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    |חיח    ופק    </div>',
  '39-23 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    חיח   | ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    |חיח    ופק    </div>',
  '39-24 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    חיח    |ופק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    |חיח    ופק    </div>',
  '39-25 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    חיח    ו|פק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    חיח    |ופק    </div>',
  '39-26 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    חיח    ופ|ק    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    חיח    |ופק    </div>',
  '39-27 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    חיח    ופק|    </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    חיח    |ופק    </div>',
  '39-28 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    חיח    ופק |   </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    חיח    |ופק    </div>',
  '39-29 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    חיח    ופק  |  </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    חיח    |ופק    </div>',
  '39-30 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    חיח    ופק   | </div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    חיח    |ופק    </div>',
  '39-31 right word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    חיח    ופק    |</div>',
  selection => selection.modify('move', 'right', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    אבצ    דעפ    חיח    |ופק    </div>',
  '39-32 right word');
</script>
